﻿using habbo.Habbo.Rooms;
using habbo.Kernel.Network;
using habbo.Kernel.Packets.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace habbo.Kernel.Packets.com.sulake.habbo.communication.messages.outgoing.navigator
{
    class MyRoomsSearchMessageComposer : ServerPacket
    {
        public MyRoomsSearchMessageComposer(Session Session)
            : base(Headers.MessageComposerIds.MyRoomsSearchMessageComposer)
        {
            base.Append(2);
            base.Append("");
            base.Append(SystemApp.HabboSystem.RoomManager.GetRooms(Session.Character.Id).Count);

            foreach (Room room in SystemApp.HabboSystem.RoomManager.GetRooms(Session.Character.Id))
            {
                Console.WriteLine(room.Caption);
                base.Append(room.Id);
                base.Append(room.Caption);
                base.Append(true);
                base.Append(room.CharacterId);
                base.Append(SystemApp.HabboSystem.CharacterManager.GetUsername(room.CharacterId));
                base.Append(0);
                base.Append(0);
                base.Append(21); //room votes?
                base.Append(room.Description);
                base.Append(0);
                base.Append(0);
                base.Append(3);
                base.Append(0);
                base.Append(0);
                base.Append("");
                base.Append("");
                base.Append("");

                base.Append(0); //tags

                base.Append(0);
                base.Append(0);
                base.Append(0);
                base.Append(0);
                base.Append(true);
                base.Append(true);


                base.Append(0);
                base.Append(0);


            }

            base.Append(false);
        }
    }
}
